home *** CD-ROM | disk | FTP | other *** search
/ CU Amiga Super CD-ROM 6 / CU Amiga Magazine's Super CD-ROM 06 (1996)(EMAP Images)(GB)(Track 1 of 4)[!][issue 1997-01].iso / imagine / docs / dof.txt next >
Text File  |  1994-04-21  |  9KB  |  170 lines

  1.  
  2. Camera Actor Bar, Depth of Field, and 3D Stereo
  3. -----------------------------------------------
  4.  
  5. You will need to be familiar with the Action Editor mechanics, and
  6. the use of Camera's X/Y axes before this will make much sense ...
  7.  
  8. There are two features in Imagine, that both "want" to use the length
  9. of the camera's Y axis, to specify an "important" and animatable distance
  10. from the camera:  Depth of Field, and 3D Stereo Image Generation.  In order
  11. to deal with this, and to provide a usable Stage/Action Editor interface
  12. to the (newer) Depth of Field feature, the Camera Actor Bar has been added.
  13. It was added rather late in development, and so its use isn't described in
  14. the manual.
  15.  
  16. For 3D Stereo, the "important distance", mentioned above, is the distance
  17. from the camera to objects you wish to appear to be "in" the screen of the
  18. monitor, ... i.e. at the surface of the monitor, not in inside or outside.
  19.  
  20. For Depth of Field, the "distance" is the distance from the camera to objects
  21. which are in perfect focus.
  22.  
  23. Both features also require you to specify a 2nd size (i.e. distance) too.
  24. For 3D Stereo, it is the distance in the "Imagine world" corresponding to
  25. the viewers "eye separation" -- which, in the past, has been described by
  26. a parameter set in the Preferences Editor, that gives that distance as
  27. a certain fraction (e.g. 0.250) of the monitor width ... and which Imagine
  28. then converted into a proper distance in its coordinate system.  For the
  29. Depth of Field feature, the 2nd size would correspond, in the real world,
  30. to the "effective" radius of the a camera lens ... i.e. to the radius of
  31. a circle at the lens surface that collects all the light that actually
  32. makes it through the lens system, and the camera's "aperture", and gets
  33. focused (however badly) onto the film.
  34.  
  35. If, you only need one of those features at a time, then in a Camera actor
  36. bar (which you must add), you should click on one of the two checkboxes
  37. at the top of the "info requester", telling Imagine to interpret the
  38. Y axis length as the (1st) "distance" you need to specify ... and then
  39. setup the 2nd size/distance as described below.  If you want to do both
  40. 3D Stereo and Depth of Field in the same project, you must set the
  41. "Distance Multiplier" value to a number to multiply the Y axis length
  42. by to get the "other" distance -- i.e. the one you don't select in the
  43. two checkboxes described above.
  44.  
  45. In the lower part of the requester, there are number slots and checkboxes
  46. to specify the "2nd" distance(s) described above, using one of two methods.
  47. One method is, like the 3D Stereo method of previous versions: as a
  48. fraction of the "width" of the cameras field of view ... which, for
  49. 3D Stereo, corresponds to the width of the monitor screen when the
  50. picture is being viewed.  For Depth of Field, its use is similar to,
  51. but not the same as specifying the "Defocus pixels" parameter used in
  52. "quickrenders".  Except that, instead of specifying a pixel count, you
  53. specify a (small) number like "0.01", which when multiplied by the number
  54. of pixels in the (width of) the image you are generating, gives the number
  55. of pixels that you wish the "infinite depth background"  to be out of
  56. focus by (e.g. 6.4 pixels for a 640 wide image, using the 0.01 value above).
  57. The second method is to specify an actual size (for the "2nd" distance)
  58. in Imagine world coordinates.  It is more useful for specifying the radius
  59. of the "effective aperture" used in depth of field, when trying to model
  60. a real world system, than it is for working with 3D Stereo images -- i.e.
  61. in order to model a camera zooming in on something, while still remaining
  62. at the same distance from it ... where, typically, the "depth of field"
  63. quality of the image gets worse in the sense that the background gets
  64. more and more out of focus, while the "subject" of the scene does not.
  65.  
  66. Finally, at the bottom of the requester is a "Transition Frame Count"
  67. box, used in "animating" the parameters.  Its use is identical to the
  68. similar boxes in the "Globals" and "Light Source" actor bars, described
  69. in the manual.
  70.  
  71.  
  72. Some useful mathematical formulas for Depth of Field
  73. ----------------------------------------------------
  74.  
  75. If you have a certain effect you whish to acheive, using depth of field,
  76. it can be difficult, sometimes, to guess which value is appropriate for
  77. the "Aperture Size", or "Defocus" pixel count used to control depth of
  78. field defocusing.  There are, in fact, so many situations we could
  79. imagine (!) here at Impulse, that we couldn't come up with a nice
  80. little requester to aid in calculating a value.  So, we present here,
  81. the basics, and a few special cases ... and hope you can make do.
  82.  
  83.  
  84. The Basics:
  85.  
  86.     In the real world, if you focus on an object that is "Y"
  87.     units away from the plane perpendicular to the line of
  88.     sight, with a "lens system" that gathers light from a circle
  89.     of radius "R", things will be more or less out of focus in
  90.     an amount proportional to the the radius "R", and inversely
  91.     proportional to the width of the field of view, "X", at the
  92.     focus distance, "Y" above.  In fact, points in the "infinite
  93.     background" will be defocused by the fraction "R/X" times the
  94.     actual width of the image produced.  In Imagine, the "X", and
  95.     "Y" values discussed above, correspond to the sizes assigned
  96.     to the camera's X and Y in the "Imagine world", and the "R"
  97.     value is determined either 1) directly if you specify that
  98.     the "aperture size" is a true distance (in world coordinates),
  99.     or 2) indirectly, as "R/X", if you specify that the "aperture
  100.     size" is a fraction of the width of the field of view, or
  101.     3) even more indirectly, as "pixel width" times "R/X", in
  102.     the case of quickrender images, where you give a pixel count.
  103.  
  104.     Now, there is a particular formula giving the "amount" that
  105.     a point gets defocused (in every direction), when it is not
  106.     in the "infinite background", but is at a distance "D" from
  107.     the plane perpendicular to the line of sight.  And depending
  108.     on whether you want a result in pixels, or as a fraction of
  109.     the image width, or as a particular size that you could compare
  110.     to the size of an object at the "perfect focus" distance, the
  111.     formula is either "image width in pixels times (R/X) times F",
  112.     or "(R/X) times F", or "R times F", respectively, ... where
  113.     the number, "F", to multiply by, is the absolute value of
  114.     "1.0 - (Y/D)".
  115.  
  116.     From these basics, a number of formulas can be generated,
  117.     depending on the particular circumstances you are confronted
  118.     with.  Some would require you to set the length of the camera's
  119.     Y axis after specifying a pair of distances and the amount of
  120.     defocusing at each distance, and some would allow you to specify
  121.     the length of the Y axis (perfect focus distance), and an amount
  122.     of defocusing at one other distance.
  123.  
  124. Setting the Y axis length:
  125.  
  126.     In general, if you have a certain range of distances ...
  127.     D1 to D2, say, and you want things to be equally out of focus
  128.     at D1 and D2, then you should set the camera Y axis size to
  129.     Y=D1*D2/((D1+D2)/2) -- the product of the distances divided by
  130.     thier average.  When D1 and D2 are pretty close to each
  131.     other, that gives a point about right in the middle.  But as
  132.     D2 gets big in comparison with D1, the result moves away from
  133.     the point midway between D1 and D2, and closer to D1.  In fact
  134.     the Y value never gets larger than 2*D1.  But it always remains
  135.     true, that if you guess at a distance to focus at, and you test
  136.     it and see that things are more out of focus at D2 (in the back),
  137.     than at D1, that you need to move the focus point out toward D2
  138.     ... and visa-versa.
  139.  
  140. Setting the aperture size:
  141.  
  142.     Once you have decided on where the proper Y axis length -- either
  143.     using the "formula" above, or because you know you want a particular
  144.     point to be in perfect focus, and you have set the camera's X axis
  145.     to get the field of view you want, you can set the aperture size
  146.     properly.  Actually, it isn't necessary to set the X axis size, if
  147.     you specify the amount of defocusing as a number of pixels, or,
  148.     equivalently as a fraction of the width of the image.
  149.  
  150.     Setting the aperture size to acheive a certain amount of defocusing
  151.     at a particular distance means that you have a certain distance
  152.     in mind -- maybe one of the two distances, D1 or D2, above.
  153.     If the distance is the "infinite background" distance, you can
  154.     just set is using one of the methods described below.  But, if
  155.     it is a "real" distance, D, you need to calculate the absolute
  156.     value of (1 - Y/D), and then divide the value below by it -- which
  157.     should increase it.
  158.  
  159.     If the "amount of defocusing" you have in mind is a certain number
  160.     of pixels, then you can simply divide the pixel count by the size
  161.     of the image in pixels, enter that number in the camera bar, and
  162.     check the "Aperture Size is Fraction of DOF Width" checkbox.
  163.  
  164.     If you want to specify the aperture as an "actual size" (and then
  165.     animate the camera's X and Y sizes, say), then you need to multiply
  166.     the value above (the ratio of defocusing pixels to image pixels)
  167.     by the size of the camera's X axis, after you have set up the camera.
  168.  
  169.  
  170.